// Copyright 2009 Pigasus.
// GNU GPL v2.
// Author: John Zhang and Jordan Rupprecht.
//
// Defines a number of common subroutines and macros that all pigasus-related
// code should include.
//
// NOTE: To enable debug messages, compile using -DENABLE_DEBUG=1 flag.

#ifndef COMMON_H_ 
#define COMMON_H_

#include <stdio.h>

#include <sstream>
#include <string>

using namespace std;

// Compile with -DENABLE_DEBUG to get debug code
#ifdef ENABLE_DEBUG
  #define debug(args...) fprintf (stderr, args)
#else
  #define debug(args...)
#endif

// Converts int to C++ string.
string IntToString(int i);

// Read an entire file into a string. Normally a bad idea, so we'll implement
// something smarter later. Returns false if there's an error, true otherwise.
bool ReadStringFromFile(string filename, string &contents);

// Writes a string to a file.
bool WriteStringToFile(string filename, string &contents);

#endif // COMMON_H_
